<?php
namespace app\admin\validate;

use think\Validate;


class AdminUpdate extends Validate
{
// 验证规则
    protected
        $rule = [
            'tel' => ['require', 'regex' => '/^1[34578]\d{9}$/'],
            'email' => ['require', 'regex' => '^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$'],
            'password' => ['require', 'alphaNum', 'min' => 6, 'max' => 20],
            'real_name' => ['require', 'regex' => '/^[\x{4e00}-\x{9fa5}]+$/u'],
        ];

// 提示信息
    protected
        $message = [
            'tel.require' => '您的用户名不能为空哦',
            'tel.regex' => '您的用户名格式不正确哦!!',
            'email.require' => '您的邮箱不能为空哦',
            'password.require' => '请输入密码',
            'password.alphaNum' => '新密码请输入数字或字母',
            'password.min' => '密码最少有6位哦!!',
            'password.max' => '密码最多有20位哦!!',
            'real_name.require' => '请输入真实姓名',
            'real_name.regex' => '请输入中文汉字',
        ];
}